<extend name="_layout/main"/>
<block name="content">
    <div class="page-content">
        <div class="page-breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="{:U('dashboard/index')}">系统首页</a>
                </li>
                <li class="">会员管理</li>
                <li class="active">会员账户</li>
            </ul>
        </div>

        <!-- Page Body -->
        <div class="page-body">
            <div class="row">
                <div class="col-lg-12 col-sm-12 col-xs-12">
                    <div class="widget">
                        <div class="widget-header bordered-left bordered-darkorange">
                            <span class="widget-caption">搜索</span>
                        </div>
                        <div class="widget-body bordered-left bordered-warning">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    身份：
                                    <select name="identity">
                                        <option value="">全部</option>
                                        <option value="0"
                                        <eq name="Think.request.identity" value="0">disabled selected</eq>
                                        >{:userIdentity(0)}</option>
                                        <option value="9"
                                        <eq name="Think.request.identity" value="9">disabled selected</eq>
                                        >{:userIdentity(9)}</option>
                                        <option value="69"
                                        <eq name="Think.request.identity" value="69">disabled selected</eq>
                                        >{:userIdentity(69)}</option>
                                        <option value="99"
                                        <eq name="Think.request.identity" value="99">disabled selected</eq>
                                        >{:userIdentity(99)}</option>
                                        <option value="109"
                                        <eq name="Think.request.identity" value="109">disabled selected</eq>
                                        >{:userIdentity(109)}</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="nickname" placeholder="手机号"
                                           value="{$Think.request.nickname}">
                                </div>
                                <button type="submit" class="btn btn-default">搜索</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-md-12">
                    <div class="widget">
                        <table class="table table-hover">
                            <thead class=" ">
                            <tr>
                                <th class="text-center" width="50">ID</th>
                                <th class="text-center">昵称</th>
                                <th class="text-center">身份</th>
                                <th class="text-center">可用积分【总 {$total.integral}】</th>
                                <th class="text-center">待用积分【总 {$total.stored_integral}】</th>
                                <th class="text-center">可倍增积分【总 {$total['integral'] - $total['unstore_integral']}】</th>
                                <th class="text-center">现金余额【总 {$total.balance}】</th>
                                <th class="text-center">商品券【总 {$total.coupon}】</th>
                                <th class="text-center">操作</th>
                            </tr>
                            </thead>

                            <tbody>
                            <notempty name="result">
                                <volist name="result" id="val" mod="2">
                                    <tr>
                                        <td class="text-center">{$val.user_id}</td>
                                        <td class="text-center">{$val.nickname}</td>
                                        <td class="text-center">{:userIdentity($val['identity'])}</td>
                                        <td class="text-center ">{$val.integral}</td>
                                        <td class="text-center ">{$val.stored_integral}</td>
                                        <td class="text-center ">{$val['integral'] - $val['unstore_integral']}</td>
                                        <td class="text-center ">{$val.balance}</td>
                                        <td class="text-center ">{$val.coupon}</td>
                                        <td class="text-center">
                                            <a href="{:U('user/pay',['id'=>$val['user_id']])}"
                                               class="btn btn-default btn-xs black"><i class="fa fa-money"></i> 充值</a>
                                        </td>
                                    </tr>
                                </volist>
                                <else/>
                                <tr>
                                    <td colspan="8" align="center">没有数据</td>
                                </tr>
                            </notempty>
                            </tbody>
                        </table>
                        <div class="row DTTTFooter">
                            <div class="col-sm-6">
                                <div class="dataTables_info" id="simpledatatable_info" role="status" aria-live="polite">

                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
                                    {$page}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <!-- /Page Body -->
    </div>

</block>
<block name="footer">
    <script>
        $(function () {
            $("select[name='identity']").change(function (e) {
                var identity = $(this).val();
                var uid = $(this).attr('uid');
                if (!isNaN(identity) && !isNaN(uid)) {
                    $.ajax({
                        url: "{:U('User/identity')}",
                        type: 'post',
                        data: {id: uid, identity: identity},
                        dataType: 'json',
                        success: function (result) {
                            tips(result.message);
                        }, error: function () {
                            tips('发生错误');
                        }
                    })
                }
            });
        })
    </script>
</block>